import {INPUT_CHANGE, ADD_LIST ,DEL_ITEM, GET_LIST} from './activeType'
import axios from 'axios'

export const inputChangeAction = (value)=>({
    type:INPUT_CHANGE,
    value
})

export const addListAction = ()=>({
    type:ADD_LIST
})

export const delItemAction = (value)=>({
    type:DEL_ITEM,
    value
})
export const getListAction = (data)=>({
    type:GET_LIST,
    value:data
})

export const getListActionAxios = ()=>{
    return(dispatch)=>{
        axios.get('http://rap2api.taobao.org/app/mock/292931/index').then(res=>{
            const action = getListAction(res.data.list)
            dispatch(action)
        })
    }
}